package easy;

import util.PrintUtils;

public class Solution_867 {

    /*public int[][] transpose(int[][] matrix) {
        int r = matrix.length;
        int c = matrix[0].length;
        if (r>=c) {
            for (int i = 0; i < r; i++) {
                for (int j = 0; j < c; j++) {
                    matrix[i][j] = matrix[i][j] ^ matrix[j][i];
                    matrix[j][i] = matrix[i][j] ^ matrix[j][i];
                    matrix[i][j] = matrix[i][j] ^ matrix[j][i];
                }
            }
        }

        return matrix;
    }*/

    public int[][] transpose(int[][] matrix) {
        int r = matrix.length;
        int c = matrix[0].length;
        int[][] res = new int[c][r];
        for (int i = 0; i < r; i++) {
            for (int j = 0; j < c; j++) {
                res[j][i] = matrix[i][j];
            }
        }
        return res;
    }

    public static void main(String[] args) {
        Solution_867 model = new Solution_867();
        int[][] transpose = model.transpose(new int[][]{{1, 2, 3}, {4, 5, 6}});
        for (int[] ints : transpose) {
            PrintUtils.arrayInt(ints);
        }
        int a = 1, b = 2;
        a = a ^ b;
        b = a ^ b;
        a = a ^ b;
        System.out.println(a);
        System.out.println(b);
    }
}
